package IO;

import java.util.Random;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Eagle
 */
public class shuffleClass {

    	public static void shuffleArray(int[] a) {
		int n = a.length;
		Random random = new Random();
		random.nextInt();
		for (int i = 0; i < n; i++) {
			int change = i + random.nextInt(n - i);
			swap(a, i, change);
		}
	}

        private static void swap(int[] a, int i, int change) {
		int helper = a[i];
		a[i] = a[change];
		a[change] = helper;
	}


        public static void shuffleArray(boolean[] a) {
		int n = a.length;
		Random random = new Random();
		random.nextInt();
		for (int i = 0; i < n; i++) {
			int change = i + random.nextInt(n - i);
			swap(a, i, change);
		}
	}

        private static void swap(boolean[] a, int i, int change) {
		boolean helper = a[i];
		a[i] = a[change];
		a[change] = helper;
	}

        public static void debugListArray(int[] array)
        {
            for (int i=0;i<array.length;i++)
            {
                System.out.println(i+":"+array[i]);
            }
        }

        public static void debugListArray(boolean[] array)
        {
            for (int i=0;i<array.length;i++)
            {
                System.out.println(i+":"+array[i]);
            }
        }


        void dp (int p)
        {
           System.out.println(p);
        }


        public static void debugListArrayCompact(int[] array)
        {
            for (int i=0;i<array.length;i++)
            {
                System.out.print(array[i]+",");
            }
            System.out.println();
        }


}

